#import "CodingValueTransformer.h"


@implementation CodingValueTransformer

+ (Class)transformedValueClass {
    return [NSData class];
}

+ (BOOL)allowsReverseTransformation {
    return YES;
}

- (id)transformedValue:(id)value {
    return [NSArchiver archivedDataWithRootObject:value];
}

// input is expected to be an NSData object
- (id)reverseTransformedValue:(id)data {
    return [NSUnarchiver unarchiveObjectWithData:data];
}

@end